1. Field of the Invention
The present invention relates generally to the field of databases and particularly to the recovery of data definitions of dropped database objects.
2. Description of the Related Art
Databases have commonly been used to store vast amounts of related information. DB2 is an application program provided by IBM to create and manage databases. Both DB2 and IBM are registered trademarks of the International Business Machines Corporation.
Databases, such as DB2, provide the capability to store and manipulate large amounts of data in a database. The data in the database is stored in tables, where each table contains both rows and columns for entries of the data. Further, information regarding data definitions of the tables, which is used to create the tables, is stored in a system catalog, which is made up of at least one table.
In order to keep the database running smoothly, it is important to have good backup and recovery mechanisms. Occasionally, in such a large database as is managed by DB2, for example, the data definitions of the database management system are inadvertently dropped from the database system, when the objects defined by the data definitions, e.g. tables, are dropped from the database system. In other words, the data definitions are deleted. Alternatively, the data definitions may be inaccessible due to corruption of a storage medium upon which the data definitions and relation information are stored. Before data may be restored from any backup copies of the database, the data definitions must be restored.
However, in prior systems, once a command causing the drop of the data definitions has been committed to in the database system, for example, there is no way to reverse the drop and restore the data. In such prior systems, the only way to restore the data was to completely rewrite the data definitions from scratch using a data definition language and then restore the actual data. However, if the administrator of the database management system has not been diligent and has not kept all of the data definitions and subsequent modifications, the rewriting of the data definitions from scratch and the subsequent restoration of the data is problematic.
These and other difficulties are overcome by the present invention, which has as an object, the provision of a method and apparatus for and an article of manufacture embodying the recovery of the data definitions using log records.
The log records of a database system maintain a record of all additions and deletions of information regarding data definitions from the system catalog of the database management system. In accordance with the present invention, log records relating to the information regarding data definitions which are deleted or otherwise inaccessible from the system catalog are first located. Next, the located log records are extracted or read. Then the data definition information is extracted from the read log records. Finally, the extracted information is translated into the appropriate data definition instructions for the database management system so that the data definitions may be restored.